package com.jackrain.nea.core.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Mapper
@Component
public interface AdSubsystemMapper {

    @Delete("DELETE from AD_SUBSYSTEM where id = #{id} and not exists (select AD_SUBSYSTEM_ID from AD_TABLECATEGORY where AD_SUBSYSTEM_ID = #{id})")
    int delete(long id);

    @Select("Select count(1) from AD_SUBSYSTEM WHERE id = #{id}")
    boolean exists(long id);
}
